# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Alex Filgueira <alexfilgueira (at antergos.com)>
# Contributor: Nate Simon <aurpkg (at natesimon.net)>

pkgname=xapp
pkgver=2.4.3
pkgrel=2
pkgdesc="Common library for X-Apps project"
arch=(loong64 x86_64)
url="https://github.com/linuxmint/${pkgname}"
license=(GPL)
depends=(libdbusmenu-gtk3 libgnomekbd)
optdepends=('python: for mate-desktop status applet')
makedepends=(meson samurai gobject-introspection python-gobject vala)
provides=(xapps)
conflicts=(xapps)
replaces=(xapps)
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('f544c2ed1902803f524fc13aaf38e1b7f6c1fa9770ca6ab2bd9306e7385b01a9')
b2sums=('49ebba445e04205f714fd4a16363674477e1156872ed1d26ac8450c32d688323971301ed97366e36141e91996f64401372dbe5ee4e36130ac4cf70e12e9fcdde')

build() {
  arch-meson ${pkgname}-${pkgver} build
  samu -C build
}

package(){
  DESTDIR="${pkgdir}" samu -C build install

  # rm useless scripts
  rm -r "${pkgdir}"/usr/bin

  # byte-compile python modules since meson does not implement autotools’ py-compile.
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -s "${pkgdir}" "${pkgdir}"${site_packages}
}
